home *** CD-ROM | disk | FTP | other *** search
/ Adobe Graphics & Publishing SDK 1996 December / Adobe Graphics & Publishing SDK 1996 December.iso / mac / After Effects 3.1 SDK Mac / Examples / UI Samples / Custom UI in fx window / AEFX_UiLib.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-04  |  1.2 KB  |  70 lines  |  [TEXT/CWIE]

  1. /**
  2.     AEFX_UiLib.c
  3.     
  4.     Part of the Adobe After Effects 3.1 SDK    
  5.     Copyright (c)1993-96, Adobe Systems Inc, All Rights Reserved.
  6.  
  7.     Revision History
  8.         1.0, created by dmw
  9. **/
  10.  
  11. #include "AEFX_UILib.h"
  12.  
  13. Boolean CreateOffscreenBitMap (GWorldPtr *newOffscreen, short depth, Rect *inBounds)
  14. {
  15.     GWorldPtr    oldPort;
  16.     GDHandle    oldDev;
  17.     OSErr        err;
  18.     GWorldPtr    newWorld;
  19.  
  20.     GetGWorld(&oldPort, &oldDev);
  21.     
  22.     err = NewGWorld(&newWorld, depth, inBounds, NULL, NULL, 0);
  23.     if (!err) {
  24.         LockPixels(newWorld->portPixMap);
  25.         SetGWorld(newWorld, NULL);
  26.         EraseRect(inBounds);
  27.         UnlockPixels(newWorld->portPixMap);
  28.         *newOffscreen = newWorld;
  29.     } else {
  30.         *newOffscreen = NULL;
  31.     }
  32.     
  33.     SetGWorld(oldPort, oldDev);
  34.     if (err) return FALSE;
  35.     else return TRUE;
  36.     
  37. }  // CreateOffscreenBitMap
  38.  
  39.  
  40.  
  41. void DestroyOffscreenBitMap (GWorldPtr oldOffscreen)
  42. {
  43.     DisposeGWorld((GWorldPtr)oldOffscreen);
  44.  
  45. }  // DestroyOffscreenBitMap
  46.  
  47.  
  48.  
  49. void InvalidateWorld (GWorldPtr offscreen, GDHandle gdH)
  50. {
  51.     GWorldPtr        saveWorld;
  52.     GDHandle        saveDevice;
  53.     Rect            r;
  54.     
  55.     GetGWorld(&saveWorld, &saveDevice);
  56.     
  57.     SetGWorld(offscreen, gdH);
  58.     r = offscreen->portRect;
  59.     EraseRect(&r);
  60.     FrameRect(&r);
  61.     MoveTo(r.left, r.top);
  62.     LineTo(r.right, r.bottom);
  63.  
  64.     MoveTo(r.right, r.top);
  65.     LineTo(r.left, r.bottom);
  66.  
  67.     SetGWorld(saveWorld, saveDevice);
  68.  
  69. }    
  70.